-
Notifications
You must be signed in to change notification settings - Fork 589
HDDS-10427. Retry read wait based on policy. #6292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ivandika3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this. LGTM overall.
I have some minor comments and nitpicks, which can be ignored / addressed.
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java
Outdated
Show resolved
Hide resolved
| throw new IOException(e); | ||
| } | ||
| return retryAction.action == RetryPolicy.RetryAction.RetryDecision.RETRY; | ||
| if (retryAction.action == RetryPolicy.RetryAction.RetryDecision.RETRY) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought: It might be nice if we can have a general RetryAction handler so that we don't need to duplicate the sleeping logic (similar codes is in AbstractDataStreamOutput#shouldRetry, GrpcOmTranport#shouldRetry, and KeyOutputStream#handleRetry)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sounds good may be we can refactor in other Jira.
| seekAndVerify(50); | ||
| byte[] b = new byte[200]; | ||
| blockInputStreamWithRetry.read(b, 0, 200); | ||
| assertThat(logCapturer.getOutput()).contains("Retry read after"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verifying debug log message is going to be brittle. But writing a test to verify time is always tricky. What I usually do is to introduce a timer class that wraps around Thread.sleep(), and we can verify the time does advance (artifically). That's going to introduce big code churn with little benefit so I'm okay with what we have now.
jojochuang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1. The change is similar to what's in KeyOutputStream.
ChenSammi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ashishkumar50 .
What changes were proposed in this pull request?
Currently when read fails from DN, client retries without waiting. In this PR, client will wait based on retry policy before reading again.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10427
How was this patch tested?
Update existing test